package net.lab1024.sa.admin.module.business.lcy.room.controller;

import net.lab1024.sa.admin.module.business.lcy.room.domain.form.LcyRoomAddForm;
import net.lab1024.sa.admin.module.business.lcy.room.domain.form.LcyRoomQueryForm;
import net.lab1024.sa.admin.module.business.lcy.room.domain.form.LcyRoomUpdateForm;
import net.lab1024.sa.admin.module.business.lcy.room.domain.vo.LcyRoomVO;
import net.lab1024.sa.admin.module.business.lcy.room.service.LcyRoomService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import cn.dev33.satoken.annotation.SaCheckPermission;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;

/**
 * 教室 Controller
 *
 * @Author yangz
 * @Date 2025-10-31 16:14:07
 * @Copyright yangz
 */

@RestController
@Tag(name = "教室")
public class LcyRoomController {

    @Resource
    private LcyRoomService lcyRoomService;

    @Operation(summary = "分页查询 @author yangz")
    @PostMapping("/lcyRoom/queryPage")
    @SaCheckPermission("lcyRoom:query")
    public ResponseDTO<PageResult<LcyRoomVO>> queryPage(@RequestBody @Valid LcyRoomQueryForm queryForm) {
        return ResponseDTO.ok(lcyRoomService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author yangz")
    @PostMapping("/lcyRoom/add")
    @SaCheckPermission("lcyRoom:add")
    public ResponseDTO<String> add(@RequestBody @Valid LcyRoomAddForm addForm) {
        return lcyRoomService.add(addForm);
    }

    @Operation(summary = "更新 @author yangz")
    @PostMapping("/lcyRoom/update")
    @SaCheckPermission("lcyRoom:update")
    public ResponseDTO<String> update(@RequestBody @Valid LcyRoomUpdateForm updateForm) {
        return lcyRoomService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author yangz")
    @PostMapping("/lcyRoom/batchDelete")
    @SaCheckPermission("lcyRoom:delete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return lcyRoomService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author yangz")
    @GetMapping("/lcyRoom/delete/{roomId}")
    @SaCheckPermission("lcyRoom:delete")
    public ResponseDTO<String> batchDelete(@PathVariable Long roomId) {
        return lcyRoomService.delete(roomId);
    }
}
